{% extends "business/ticket.html" %}
{% block content %}
<form id="input_form" class="form-inline" action="" method="post">
    {% csrf_token %}
    <div class="row">
          <div class="col-md-4 form-group">
              <label for="level">故障级别：</label>
              <select name="level" id="level" class="form-control">
                  <option>普通</option>
                  <option>严重</option>
                  <option>紧急</option>
              </select>
              <script>
                  $(document).ready(function () {
                      $("#level").find("option:contains({{ ticket.level }})").attr("selected",true);
                  })
              </script>
          </div>
          <div class="col-md-4 form-group">
              <label for="handler">当前处理人：</label>
              <select name="handler" id="handler" class="form-control">
                  <option>none</option>
                  <option>richerd</option>
                  <option>ian</option>
                  <option>lijian</option>
                  <option>tyler</option>
                  <option>mark</option>
                  <option>joyce</option>
                  <option>other</option>
              </select>
              <script>
                  $(document).ready(function () {
                      $("#handler").find("option:contains({{ ticket.handler }})").attr("selected",true);
                  })
              </script>
          </div>
          <div class="col-md-4 form-group">
              <label for="status">当前状态：</label>
              <select name="status" id="status" class="form-control">
                  <option>处理中</option>
                  <option>暂停处理</option>
                  <option>已关闭</option>
              </select>
              <script>
                  $(document).ready(function () {
                      $("#status").find("option:contains({{ ticket.status }})").attr("selected",true);
                  })
              </script>
          </div>
    </div>
    <br>

    <div class="row">
          <div class="col-md-4 form-group">
              <label for="describe"><span style="color: red;font-weight:bold">*</span>故障详细描述(限1200字)：</label>
              <textarea id="describe" class="form-control" name="describe" rows="6" cols="50">
{{ ticket.describe }}
              </textarea>
          </div>
          <div class="col-md-4 form-group">
              <label for="start_time"><span style="color: red;font-weight:bold">*</span>客户报障日期：</label>
              <input id="start_time" class="form-control datepicker" type="text" name="start_time" value="{{ ticket.start_time }}">
          </div>
          <div class="col-md-4 form-group">
              <label for="end_time">处理完成日期：</label>
              <input id="end_time" class="form-control datepicker" type="text" name="end_time" value="{{ ticket.end_time }}">
          </div>
    </div>
    <br>

    <button id="submit_button" type="submit" class="btn btn-primary">保存</button>
    <a class="btn btn-primary" href="/business/show_ticket/{{ ticket.id }}" role="button">取消</a>
</form>
<script>
$(document).ready($("#submit_button").click(function () {

    $('#input_form input,textarea').each(function () {
        $(this).val($.trim($(this).val()));
    });

}));
</script>

<script>
    $(function () {
        $(".datepicker").datepicker({
            autoclose: true,
            language: "zh-CN",
            defaultViewDate: 'today',
            orientation: 'bottom',
            todayBtn: true,
            todayHighlight: true
        });
    })
</script>
{% endblock %}